/*
 * @Author: wuqingchun
 * @Date: 2024-07-31 08:50:46
 * @Description: 
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-07-31 17:04:53
 */

#include <stdio.h>
#include <signal.h>

#include "ev_dispatcher.h"
#include "ev_event.h"


int called = 0;

static void __signal_CB(int fd, void *arg)
{
	EV_EVENT_S *pstSignal = arg;

	printf("signal_cb: got signal %d\n", EV_event_GetSignal(pstSignal));

	if (called >= 2)
		//event_del(signal);

	called++;
}

int main(int argc, char** argv)
{
    EV_DISPATCHER_S* pstDP = EV_dispatcher_Create();

    if (pstDP == NULL)
    {
        return 0;
    }

    EV_dispatcher_AddEvent(pstDP, SIGINT, EV_FLAG_SIGNAL, __signal_CB, NULL);

    EV_dispatcher_Dispatch(pstDP);
}